  
$(document).ready(function() {
 $('#htxtTargetURL').val(getQueryStringParams("targeturl"));
 
 var appid = window.location.search.substring(1); 
 alert(window.location.href);
 window.fbAsyncInit = function () {
     FB.init({
         appId: $('#appid').val(), // App ID
         channelUrl: 'localhost', // Channel File
         status: true, // check login status
         cookie: true, // enable cookies to allow the server to access the session
         xfbml: true, // parse XFBML
         frictionlessRequests : true
     });
 };
 // Load the SDK Asynchronously
 (function (d) {
     var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
     if (d.getElementById(id)) {
         return;
     }
     js = d.createElement('script');
     js.id = id;
     js.async = true;
     js.src = "//connect.facebook.net/en_US/all.js";
     ref.parentNode.insertBefore(js, ref);
 } (document));
 
    $("#btnShowContent").click(
		function(){
	    	var response ;
	    	$.ajax({
		    	url: $('#messageLink').val(),
		    	dataType:'html',
		        success : function(result)
		        {
		        	debugger
		        	alert($(result).contents().find('meta[name=description]').attr('content'));
		        	response = result;
		        },
		        error: function(error) {
		           	   console.log(error.status);
		               alert(error.status);
		           }
	    	});
			$("#contentHolder").val(response);
	    	//alert(response);
	    });
    
});
function getQueryStringParams(sParam) {
    var sPageURL = window.location.search.substring(1);
    var sURLVariables = sPageURL.split('&');
    for (var i = 0; i < sURLVariables.length; i++) {
        var sParameterName = sURLVariables[i].split('=');
        if (sParameterName[0] == sParam) {
            return sParameterName[1];
        }
    }
}
